/**
 *	flowset的流程模块接口
 *	开发者：雨中磐石
 *	地址：www.rockoa.com
 *	日期：2023-07-19
 */

package com.framework.Module.flow.flowset;



import com.framerock.baselib.Rock;
import com.framework.Flow.FlowListener;
import com.framework.Table.Table;
import java.util.Map;

public class FlowListenerflowset extends FlowListener {



    public Boolean onModejs() { return true;}

    @Override
    public String onDeletebefore() {
        int isxt = Rock.getMapint(mFlow.data, "isxt");
        if(isxt==1)return "系统级的模块不能删除";
        return "";
    }




    public void onSaveafter(Map<String, String> da, String mid, Boolean isadd) {
        String table    = da.get("table");
        int islc        = Rock.getMapint(da, "islc");
        String alltab[] = this.nDb.getAlltable();
        if(alltab!=null){
            Table tab = Table.get(this.nDb, table, da.get("name"));
            tab.addfields("cid", "int(11)", "0", "对应单位ID");
            tab.addfields("aid", "int(11)", "0", "单位用户ID");
            if(islc == 1) tab.addfields("status", "tinyint(1)", "0", "状态");
            tab.addfields("cid", "KEY", "`cid`", "cid索引");
            if(islc == 1){
                tab.updateTable(alltab);
            }else {
                tab.createTable(alltab);
            }
        }
    }


}
